package org.example.service.impl;

import java.util.List;
import javax.annotation.Resource;
import org.example.service.PostageService;
import org.example.strategyPatterns01.PostageStrategy;
import org.springframework.stereotype.Service;

/**
 * author lyq
 * since 2024-12-02 14:43
 * description
 */
@Service
public class PostageServiceImpl implements PostageService {

  @Resource
  private List<PostageStrategy> postageStrategies;
  @Override
  public Double getPostage(Integer type) {
    for (PostageStrategy postageStrategyService : postageStrategies) {
      if (postageStrategyService.isCompare(type)){
        return postageStrategyService.getPostage(type);
      }
    }
    return null;
  }
}
